public class test07 {

    public static void main(String[] args) {

        String s="sshelloworldhellojavahellojsp";
        char[] chars = s.toCharArray();
        int count=0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]=='h'){
                if (chars[i+1]=='e'&&chars[i+2]=='l'&&chars[i+3]=='l'&&chars[i+4]=='o'){
                    System.out.println("索引为："+i);
                    count++;
                }
            }
        }
        System.out.println("出现了"+count);
    }
}
